<?php
/**
 * Created by PhpStorm.
 * User: zouhua
 * Date: 2017/5/2
 * Time: 15:33
 */

namespace app\widgets;


use app\models\ActivityApply;
use app\utils\BaseUtils;
use yii\base\Widget;

class ApplyListWidget extends Widget {

    public $own_id;
    public $own = ActivityApply::OWN_ACTIVITY;

    public function run() {
        $models = ActivityApply::getApplyList($this->own_id, $this->own);
        $tpl = '<span class="ui-avatar-s"><span style="background-image:url(%avatar)"></span></span>';
        $html = '';
        foreach ($models as $model) {
            $avatar = BaseUtils::getAvatar($model['user']['avatar']);
            $html .= str_replace('%avatar', $avatar, $tpl);
        }

        return $html;
    }
}